package com.yeqifu.sys.controller;

import com.yeqifu.sys.domain.LogInfo;
import com.yeqifu.sys.service.ILogInfoService;
import com.yeqifu.sys.utils.ResultObj;
import com.yeqifu.sys.vo.LogInfoVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 日志管理控制器
 */
@RestController
@RequestMapping("logInfo")
public class LogInfoController {
    @Autowired
    private ILogInfoService logInfoService;

    /**
     * 加载日志列表返回DataGridView
     * @param logInfo
     */
    @RequestMapping("loadAllLogInfo")
    public List<LogInfo> loadAllLogInfo(LogInfo logInfo){
        return logInfoService.selectLogInfo(logInfo);
    }

    /**
     * 删除一条日志
     * @param logInfoVo
     * @return
     */
    @RequestMapping("deleteLogInfo")
    public ResultObj deleteLogInfo(LogInfoVo logInfoVo){
            logInfoService.deleteLoginfo(logInfoVo);
        return ResultObj.DELETE_SUCCESS;
    }

    /**
     * 批量删除日志
     * @param logInfoVo
     * @return
     */
    @RequestMapping("deleteBatchLogInfo")
    public ResultObj deleteBatchLogInfo(LogInfoVo logInfoVo) {
        logInfoService.deleteBatchLogInfo(logInfoVo.getIds());
        return ResultObj.DELETE_SUCCESS;
    }
}
